import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

import java.net.URI;

public class FileInfo {
    public static void main(String[] args) throws Exception {
        if (args.length != 1) {
            System.err.println("Usage: FileInfo <sources>");
            System.exit(2);
        }

        Configuration conf = new Configuration();
        FileSystem fs = FileSystem.get(URI.create(args[0]), conf);
        FileStatus status = fs.getFileStatus(new Path(args[0]));

        System.out.println(status.getPath());
        System.out.println(status.getLen());
        System.out.println(status.getModificationTime());
        System.out.println(status.getOwner());
        System.out.println(status.getReplication());
        System.out.println(status.getBlockSize());
        System.out.println(status.getGroup());
        System.out.println(status.getPermission());
    }
}
